home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fludfill / fludfill.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  3.2 KB  |  100 lines

  1. VERSION 2.00
  2. Begin Form Form2 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Form2"
  5.    ClientHeight    =   6360
  6.    ClientLeft      =   795
  7.    ClientTop       =   1950
  8.    ClientWidth     =   9630
  9.    Height          =   6765
  10.    Icon            =   FLUDFILL.FRX:0000
  11.    Left            =   735
  12.    LinkTopic       =   "Form2"
  13.    Picture         =   FLUDFILL.FRX:0302
  14.    ScaleHeight     =   424
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   642
  17.    Top             =   1605
  18.    Width           =   9750
  19.    Begin CommandButton Command2 
  20.       Caption         =   "AutoRedraw = FALSE"
  21.       Height          =   372
  22.       Left            =   1440
  23.       TabIndex        =   2
  24.       Top             =   600
  25.       Width           =   2652
  26.    End
  27.    Begin PictureBox Picture2 
  28.       BackColor       =   &H00FFFFFF&
  29.       ForeColor       =   &H00FFFFFF&
  30.       Height          =   132
  31.       Left            =   120
  32.       ScaleHeight     =   105
  33.       ScaleWidth      =   1185
  34.       TabIndex        =   1
  35.       Top             =   720
  36.       Width           =   1212
  37.    End
  38.    Begin PictureBox Picture1 
  39.       AutoSize        =   -1  'True
  40.       BorderStyle     =   0  'None
  41.       FontBold        =   -1  'True
  42.       FontItalic      =   0   'False
  43.       FontName        =   "Courier"
  44.       FontSize        =   9.75
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       Height          =   525
  48.       Left            =   1440
  49.       Picture         =   FLUDFILL.FRX:3181C
  50.       ScaleHeight     =   35
  51.       ScaleMode       =   3  'Pixel
  52.       ScaleWidth      =   428
  53.       TabIndex        =   0
  54.       Top             =   120
  55.       Width           =   6420
  56.    End
  57.    Begin Label Label1 
  58.       Caption         =   "Choose a color..."
  59.       Height          =   492
  60.       Left            =   120
  61.       TabIndex        =   3
  62.       Top             =   120
  63.       Width           =   1212
  64.    End
  65. Sub Command2_Click ()
  66. form2.AutoRedraw = Not form2.AutoRedraw
  67. If form2.AutoRedraw Then
  68.     Command2.Caption = "AutoRedraw = TRUE"
  69.     Command2.Caption = "AutoRedraw = FALSE"
  70. End If
  71. End Sub
  72. Sub Form_Load ()
  73. xcolor = RGB(255, 255, 255)
  74. End Sub
  75. Sub Form_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  76.     FillStyle = 0                   ' Set FillStyle to solid.
  77.     FillColor = xcolor              ' Set FillColor.
  78.     FloodFill hDC, x, y, forecolor  ' Call Windows API to fill.
  79.     Dim h As Long
  80.     h = getpixel(hDC, 0, 0)
  81.     If h = RGB(255, 255, 255) Then      'force background to remain white
  82.     Else
  83.         FillColor = RGB(255, 255, 255)
  84.         FloodFill hDC, 8, 15, forecolor
  85.     End If
  86.     If form2.AutoRedraw = True Then
  87.         form2.Refresh     'shows changes made to the picture when autoredraw is true.
  88.     End If                'changes are temporary otherwise, or not visible without this statement.
  89. End Sub
  90. Sub Picture1_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  91.     Dim wcolor As Long
  92.     wcolor = getpixel(Picture1.hDC, x, y)
  93.     If wcolor < 1 Then
  94.         Beep
  95.     Else
  96.         xcolor = wcolor
  97.     End If
  98.     Picture2.BackColor = xcolor
  99. End Sub
  100.